Skip to content

fix: prevent PostgreSQL Remote OOM (#618), restore Kafka unauth detection (#615), and fix Set-Cookie POC search (#339) - #621

Merged
ZacharyZcR merged 1 commit into
mainfrom
fix/issues-618-615-339
Dec 1, 2026
Merged

ZacharyZcR merged 1 commit into
mainfrom
fix/issues-618-615-339

Conversation

@ZacharyZcR

Copy link
Copy Markdown
Collaborator

Summary

Fixes three reported bugs with targeted regression tests:

  1. PostgreSQL Remote OOM (plugins/services/postgresql.go) — Fixes [Bug] Remote OOM #618

    • github.com/lib/pq allocates make([]byte, n) directly from the peer-controlled 4-byte wire length without an upper bound (e.g., an HTTP/ response allocates ~1.41 GB and crashes the process; a malicious honeypot can request 4 GB per connection).
    • Add probePostgreSQLWire (standard 8-byte SSLRequest pre-check) to reject non-PostgreSQL/HTTP services upfront.
    • Wrap all lib/pq connections via pq.NewConnector + safePGDialer/safePGConn (also routing PostgreSQL through session.DialTCP for proxy/rate-limit support), enforcing a hard 4 MB per-message wire length bound before bytes reach lib/pq.
    • Added unit tests covering both HTTP/1.1 responses and a malicious 4 GB honeypot frame.
  2. Kafka Unauthorized Access False Negative (plugins/services/kafka.go) — Fixes [Accuracy] Fscan 2.2.2 漏报 Kafka 未授权访问(被误报为未发现弱密码) #615

    • Restore testUnauthorizedAccess before credential brute-forcing: probes ApiVersions + Metadata (v0) and validates that the response contains at least one valid broker entry before reporting unauthorized access.
    • Add kafka_unauth localization entries (zh.yaml, en.yaml) and unit test TestKafkaDetectsUnauthorizedAccess.
  3. POC Set-Cookie: Search Failure (webscan/lib/poc_executor.go) — Fixes Cookie问题 #339

    • ParseResponse normalizes HTTP header keys to lowercase (set-cookie), causing case-sensitive search: Set-Cookie:(?P<cookie>.*?) rules to fail and abort subsequent chained rules.
    • Fall back to case-insensitive regex matching for Set-Cookie: search patterns and apply optimizeCookies regardless of case.
    • Added unit test TestDoSearchMatchesCaseInsensitiveSetCookieHeader.

Verification

  • go test -race ./plugins/services ./webscan/lib ./common/i18n

…afka unauth detection, and fix case-insensitive Set-Cookie POC search
@ZacharyZcR
ZacharyZcR merged commit a044806 into main Dec 1, 2026
3 checks passed
@ZacharyZcR
ZacharyZcR deleted the fix/issues-618-615-339 branch December 1, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Remote OOM [Accuracy] Fscan 2.2.2 漏报 Kafka 未授权访问(被误报为未发现弱密码) Cookie问题

1 participant